home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
graphic
/
frasr182.zip
/
PROMPTS2.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-18
|
51KB
|
1,795 lines
/*
Various routines that prompt for things.
This module is linked as an overlay, use ENTER_OVLY and EXIT_OVLY.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#ifndef XFRACT
#include <dos.h>
#elif !defined(__386BSD__)
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/dir.h>
#endif
#ifdef __TURBOC__
#include <alloc.h>
#elif !defined(__386BSD__)
#include <malloc.h>
#endif
#ifdef __hpux
#include <sys/param.h>
#define getwd(a) getcwd(a,MAXPATHLEN)
#endif
#include "fractint.h"
#include "fractype.h"
#include "helpdefs.h"
#include "prototyp.h"
/* Routines defined in prompts1.c */
extern int prompt_checkkey(int curkey);
extern long get_file_entry(int,char *,char *,char *,char *);
/* Routines used in prompts1.c */
int get_corners(void);
int edit_ifs_params(void );
int lccompare(VOIDCONSTPTR, VOIDCONSTPTR); /* Needed in prompts1.c PAV */
/* Routines in this module */
static int findfirst(char *path);
static int check_f6_key(int curkey,int choice);
static int findnext(void );
int splitpath(char *template,char *drive,char *dir,char *fname,char *ext);
int makepath(char *template,char *drive,char *dir,char *fname,char *ext);
static void fix_dirname(char *dirname);
static int expand_dirname(char *dirname,char *drive);
static int filename_speedstr(int, int, int, char *, int);
static int isadirectory(char *s);
static int check_f6_key(int curkey,int choice);
extern int dotmode;
extern int orbit_delay;
extern char diskfilename[];
extern char *fract_dir1, *fract_dir2;
#ifndef XFRACT
extern int strncasecmp(char *s,char *t,int ct);
#endif
extern char temp1[256]; /* temporary strings */
extern double xxmin,xxmax; /* initial corner values */
extern double yymin,yymax; /* initial corner values */
extern BYTE usemag;
extern int AntiAliasing;
extern double zzmin, zzmax, ttmin, ttmax;
extern int Transparent3D;
extern double xx3rd,yy3rd; /* initial corner values */
extern int invert; /* non-zero if inversion active */
extern double inversion[3]; /* radius, xcenter, ycenter */
extern int pot16bit;
extern int disk16bit;
extern double potparam[3]; /* three potential parameters*/
extern int fractype; /* if == 0, use Mandelbrot */
extern char usr_floatflag; /* floating-point fractals? */
extern int maxit; /* try this many iterations */
extern int inside; /* inside color */
extern int fillcolor; /* fill color */
extern int outside; /* outside color */
extern int finattract; /* finite attractor switch */
extern char savename[80]; /* save files using this name */
extern int decomp[]; /* decomposition parameters */
extern int usr_distest; /* distance estimator option */
extern int distestwidth;
extern char usr_stdcalcmode; /* '1', '2', 'g', 'b' */
extern char overwrite; /* overwrite= flag */
extern int soundflag; /* sound option */
extern int LogFlag; /* non-zero if logarithmic palettes */
extern int usr_biomorph; /* Biomorph flag */
#if 0
//extern long xmin, xmax, ymin, ymax; /* screen corner values */
#endif
extern int xdots, ydots; /* coordinates of dots on the screen */
extern int colors; /* maximum colors available */
extern int row, col;
extern int viewwindow;
extern float viewreduction;
extern int viewcrop;
extern float finalaspectratio;
extern int viewxdots,viewydots;
extern int textcbase;
extern int textrow,textcol;
extern int resave_flag; /* resaving after a timed save */
extern int started_resaves;
extern char boxy[];
extern int rotate_lo,rotate_hi;
extern int rangeslen;
extern float screenaspect;
extern int cmdarg(char *,int);
extern char CommandFile[];
extern char CommandName[];
extern float far *ifs_defn;
extern int ifs_type;
extern int ifs_changed;
extern int initbatch; /* 1 if batch run (no kbd) */
/* speed key state values */
#define MATCHING 0 /* string matches list - speed key mode */
#define TEMPLATE -2 /* wild cards present - buiding template */
#define SEARCHPATH -3 /* no match - building path search name */
#define FILEATTR 0x37 /* File attributes; select all but volume labels */
#define HIDDEN 2
#define SYSTEM 4
#define SUBDIR 16
#define MAXNUMFILES 300
struct /* Allocate DTA and define structure */
{
char path[21]; /* DOS path and filespec */
char attribute; /* File attributes wanted */
int ftime; /* File creation time */
int fdate; /* File creation date */
long size; /* File size in bytes */
char filename[13]; /* Filename and extension */
} DTA; /* Disk Transfer Area */
#define GETFORMULA 0
#define GETLSYS 1
#define GETIFS 2
#define GETPARM 3
/* --------------------------------------------------------------------- */
extern char s_iter[];
extern char s_real[];
extern char s_mult[];
extern char s_sum[];
extern char s_imag[];
extern char s_zmag[];
extern char s_bof60[];
extern char s_bof61[];
extern char s_maxiter[];
extern char s_epscross[];
extern char s_startrail[];
extern char s_normal[];
extern char s_period[];
char commandmask[13] = {"*.par"};
void prompts2_overlay() { } /* for restore_active_ovly */
#if 0
/* --------------------------------------------------------------------- */
extern int promptfkeys;
int edit_ifs_params() /* prompt for IFS params */
{
int totcols;
int i, j, k, numlines, ret;
FILE *tempfile;
char msg[81];
char filename[81];
float ftemp;
int oldhelpmode;
int low, hi;
if (!ifs_defn && !ifsload())
return(-1);
totcols = (ifs_type == 0) ? IFSPARM : IFS3DPARM;
ret = 0;
oldhelpmode = helpmode;
helpmode = HT_IFS;
low = 0;
for ( ;; ) {
static char far ifshdg2[]={"2D IFS Parameters"};
static char far ifshdg3[]={"3D IFS Parameters"};
static char far ifsparmmsg1[]={"# a b c d e f"};
static char far ifsparmmsg2[]={" g h i j k l"};
static char far ifsprompt[]={"\
Enter the number of the line you want to edit,\n\
S to save, F6 for corners, or ENTER to end ==>"};
int leftcol,promptrow,promptcol;
#define IFS_NUM 12
for (numlines = 0; numlines < NUMIFS; numlines++) /* find the first zero entry */
if (ifs_defn[(numlines * totcols) + totcols - 1] <= 0.0001) break;
helptitle();
setattr(1,0,C_PROMPT_BKGRD,24*80); /* init rest of screen to background */
putstringcenter(2,0,80,C_GENERAL_HI,(ifs_type == 0) ? ifshdg2 : ifshdg3);
leftcol = (ifs_type == 0) ? 15 : 0;
putstring(4,leftcol+1,C_GENERAL_HI,ifsparmmsg1);
if (ifs_type != 0)
putstring(-1,-1,C_GENERAL_HI,ifsparmmsg2);
putstring(-1,-1,C_GENERAL_HI," prob \n\n");
hi = low+IFS_NUM;
if (hi>numlines) hi = numlines;
for (i = low; i < hi; i++) {
sprintf(msg,"%2d", i+1);
putstring(5+i-low,leftcol,C_GENERAL_HI,msg);
for (j = 0; j < totcols; j++) {
sprintf(msg,"%6.2f",ifs_defn[(i*totcols)+j]);
putstring(-1,-1,C_GENERAL_MED,msg);
}
}
if (hi<numlines) {
putstring(5+IFS_NUM,leftcol,C_GENERAL_HI,"(more)");
}
textcbase = 14;
putstring(5+i-low+1,0,C_GENERAL_HI,ifsprompt);
promptrow = textrow;
promptcol = textcol + textcbase + 1;
temp1[0] = textcbase = 0;
promptfkeys = 1<<6;
i = input_field(0,C_GENERAL_INPUT,temp1,2,promptrow,promptcol,
prompt_checkkey);
if (i<0) {
break;
} else if (i==PAGE_UP) {
low -= IFS_NUM;
if (low<0) low=0;
} else if (i==UP_ARROW) {
low -= 1;
if (low<0) low=0;
} else if (i==DOWN_ARROW) {
low += 1;
if (low+IFS_NUM>numlines) low=numlines-IFS_NUM;
if (low<0) low=0;
} else if (i==PAGE_DOWN) {
low += IFS_NUM;
if (low+IFS_NUM>numlines) low=numlines-IFS_NUM;
if (low<0) low=0;
} else if (i==F6) {
if (get_corners()) {
ret = 1;
}
} else if (i==0) {
if (temp1[0]==0) break;
} else {
continue;
}
putstring(promptrow,promptcol,C_GENERAL_HI,temp1);
if (temp1[